package cn.uestc.labhms.modules.hms.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.uestc.labhms.modules.hms.entity.MagInspectInfoEntity;
import cn.uestc.labhms.modules.hms.service.MagInspectInfoService;
import cn.uestc.labhms.common.utils.PageUtils;
import cn.uestc.labhms.common.utils.R;



/**
 * 
 *
 * @author Mu.tz
 * @email Mutz@gmail.com
 * @date 2021-11-01 20:33:41
 */
@RestController
@RequestMapping("hms/maginspectinfo")
public class MagInspectInfoController {
    @Autowired
    private MagInspectInfoService magInspectInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("hms:maginspectinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = magInspectInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{seqId}")
    @RequiresPermissions("hms:maginspectinfo:info")
    public R info(@PathVariable("seqId") String seqId){
		MagInspectInfoEntity magInspectInfo = magInspectInfoService.getById(seqId);

        return R.ok().put("magInspectInfo", magInspectInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("hms:maginspectinfo:save")
    public R save(@RequestBody MagInspectInfoEntity magInspectInfo){
		magInspectInfoService.save(magInspectInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("hms:maginspectinfo:update")
    public R update(@RequestBody MagInspectInfoEntity magInspectInfo){
		magInspectInfoService.updateById(magInspectInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("hms:maginspectinfo:delete")
    public R delete(@RequestBody String[] seqIds){
		magInspectInfoService.removeByIds(Arrays.asList(seqIds));

        return R.ok();
    }

}
